﻿using IResoitory;
using IService;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace Service
{
    //服务层_基类接口实现类（通用）
    public abstract class BaseService<TEntity> : IBaseService<TEntity> where TEntity : class
    {
        protected IBaseRepository<TEntity> BaseRepository;
        public Task<bool> onAdd(TEntity entity)
        {
           return BaseRepository.onAdd(entity);
        }

        public Task<bool> onDelete(int id)
        {
           return BaseRepository.onDelete(id);
        }

        public Task<List<TEntity>> onFindAllAsync()
        {
           return BaseRepository.onFindAllAsync();
        }

        public Task<TEntity> onFindByIdAsync(int id)
        {
           return BaseRepository.onFindByIdAsync(id);
        }

        public Task<List<TEntity>> onFindManyAsync(Expression<Func<TEntity, bool>> exp)
        {
            return BaseRepository.onFindManyAsync(exp);
        }

        public Task<TEntity> onFindOneAsync(Expression<Func<TEntity, bool>> exp)
        {
           return BaseRepository.onFindOneAsync(exp);
        }

        public Task<bool> onUpdate(TEntity entity)
        {
           return BaseRepository.onUpdate(entity);
        }
        public Task<bool> islogin(string uid, string pwd)
        {
            return BaseRepository.islogin(uid, pwd);
        }
    }
}
